<?php
//计算字符串的ascii之和
function getAscSum($str){
	$all = str_split($str);
	$sum = 0;
	for($i = 0; $i < count($all);$i++){
		$sum += ord($all[$i]);
	}
	return $sum;
}

function createCodeJson($info=''){
    header('Content-type: application/json');
	$time = time().rand(20000,90000);
	$id = md5(CODE_KEY1.$time.CODE_KEY2);

    $yiyou = IS_DEBUG?'&yiyou=1':'';
	$result = array(
			'img'=>'slider,get?time='.$time.'&id='.$id.'&nowebp=1'.$yiyou,
			'id'=>$id,
			'time'=>$time,
			'info'=>$info
	);

	if(r('yiyou')==1){
		$result['tn_r'] = TnCode::createRand($time);
	}
	return($result);
}